fix(components): Hide tooltips when out of view#2894
Conversation
When a tooltip was scrolled out of view, it was still visible. This is now fixed using FloatingUI's `hide()` middleware to detect when it's out of view.
| style={floatingStyles.float} | ||
| ref={setTooltipRef} | ||
| role="tooltip" | ||
| hidden={isHidden} |
There was a problem hiding this comment.
Ensures it's hidden from screen readers
Deploying atlantis with
|
| Latest commit: |
24f89c0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ee485c58.atlantis.pages.dev |
| Branch Preview URL: | https://job-148568-hide-tooltips-whe.atlantis.pages.dev |
I can log a bug ticket for that. Indeed that sounds like it's outside the scope of this Tooltip issue. |
ZakaryH
left a comment
There was a problem hiding this comment.
LGTM, the only thing I would ask for are some visual regression tests. still happy to approve without them though.
| @@ -1,88 +1,59 @@ | |||
| import { | |||
There was a problem hiding this comment.
@ZakaryH I updated the tooltip tests as discussed.
I broke it into 2 commits:
- with my fix disabled, so it's the before state: eb0c2ed
- with my fix enabled, and you can see the offscreen tooltip is no more! 24f89c0
Demo is here if you want to test while running the docs site: http://localhost:5173/visual-tests/tooltip
ZakaryH
left a comment
There was a problem hiding this comment.
still LGTM thanks for adding the tests!




Motivations
This PR fixes an issue where tooltips, when out of view, aren't technically hidden and can cause scrollbars unnecessarily.
Using the hide middleware from FloatingUI to handle this, as suggested by @ZakaryH.
Before
Tooltip remains visible when scrolled out of view, leading to the scrollable area increasing.
Screen.Recording.2026-01-30.at.2.58.54.PM.mov
After
Tooltip no longer is visible when out of view.
Screen.Recording.2026-01-30.at.2.59.10.PM.mov
Changes
Fixed
Testing
docs/components/Combobox/Web.stories.tsxisHidden: false, repeat the steps and you'll see the tooltip still visible as it's scrolled outside of the inner containerSnippet...